package server;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.List;

import exceptions.LogsStoreException;

public class FileLogWriter implements LogWriter{
	private File targetFile= new File("/home/tarena/0DMS/targetFile");
	public void writeLog(String labip, List<String> data) throws LogsStoreException {
		try {
			PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(targetFile)));
			for (String s : data) {
				writer.println(s);
				writer.flush();
			}
			writer.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			throw new LogsStoreException(e);
		}
	}

}
